// rollup.config.prod.js
import path from "path";
import babel from "@rollup/plugin-babel";
import commonjs from "rollup-plugin-commonjs";
import sourceMaps from "rollup-plugin-sourcemaps";
import resolve from "@rollup/plugin-node-resolve";
import typescript from "rollup-plugin-typescript2";

export default {
  input: "./src/index.ts",

  output: [
    {
      name: "iota-utools",
      dir: path.join("lib/cjs"),
      format: "cjs",
      preserveModules: true,
      preserveModulesRoot: "src",
    },
    {
      name: "iota-utools",
      dir: path.join("lib/es"),
      format: "es",
      preserveModules: true,
      preserveModulesRoot: "src",
    },
  ],

  plugins: [
    resolve({
      customResolveOptions: {
        moduleDirectory: "node_modules",
      },
    }),
    commonjs(),
    typescript(),
    sourceMaps(),
    babel({
      runtimeHelpers: true,
      exclude: "node_modules/**",
      babelHelpers: "bundled",
    }),
  ],
};
